﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading;

namespace AssistantStartHelper
{
    public partial class Service1 : ServiceBase
    {
        public Service1()
        {
            InitializeComponent();
          
        }

        private Thread thr;
        protected override void OnStart(string[] args)
        {
            //if (!Debugger.IsAttached)
            //{
            //    Debugger.Launch();
            //}


            //FileStream fs = new FileStream(@"d:\mcWindowsService.txt", FileMode.OpenOrCreate, FileAccess.Write);

            //StreamWriter m_streamWriter = new StreamWriter(fs);

            //m_streamWriter.BaseStream.Seek(0, SeekOrigin.End);

            //m_streamWriter.WriteLine("mcWindowsService:         Service Started" + DateTime.Now.ToString() + "\n");

            //m_streamWriter.Flush();

            //m_streamWriter.Close();

            //fs.Close();
            thr = new Thread(StartProcess);
            thr.Start();
            //StartProcess();

        }

        private void StartProcess()
        {
             
             while (true)
            {
                        
                Startup.StartupAssist();
                Thread.Sleep(60000);
            }
           
            
        }

        protected override void OnStop()
        {
        }
    }
}
